package 学生管理系统;

public abstract class Person {
    //1. 属性
    private int id;
    private String name;
    private int age;
    private String gender;

    //2. 空参 全参
    public Person() {
    }

    public Person(int id, String name, int age, String gender) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.gender = gender;
    }

    //3. getXxx()  setXxx()
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    //4. 行为
    //工作,由于工作内容不同,这里要定义成抽象方法
    public abstract String work();

    //5. 重写toString
    @Override
    public String toString() {
        return "Person{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                ", gender='" + gender + '\'' +
                '}';
    }

    //定义show()方法,用来打印学生信息
    public String show() {
        return id + "\t\t" + name + "\t\t" + age + "\t\t" + gender;
    }
}
